#define _CRT_SECURE_NO_WARNINGS
#include"Sort.h"

void TestInsertSort()
{
	printf("InsertSort:\n");
	int a[] = { 5,3,1,6,2,4 };
	int sz = sizeof(a) / sizeof(a[0]);
	PrintArr(a, sz);
	InsertSort(a, sz);
	PrintArr(a, sz);
}

void TestShellSort()
{
	printf("ShellSort:\n");
	int a[] = { 2,4,5,7,8,1,6,9,0,3 };
	int sz = sizeof(a) / sizeof(a[0]);
	PrintArr(a, sz);
	ShellSort(a, sz);
	PrintArr(a, sz);
}


void TestSelectSort1()
{
	printf("SelectSort1:\n");
	int a[] = { 2,4,5,7,8,1,6,9,0,3 };
	int sz = sizeof(a) / sizeof(a[0]);
	PrintArr(a, sz);
	SelectSort1(a, sz);
	PrintArr(a, sz);
}

void TestSelectSort2()
{
	printf("SelectSort2:\n");
	int a[] = { 2,4,5,7,8,1,6,9,0,3 };
	int sz = sizeof(a) / sizeof(a[0]);
	PrintArr(a, sz);
	SelectSort2(a, sz);
	PrintArr(a, sz);
}

void TestHeapSort()
{
	printf("HeaptSort:\n");
	int a[] = { 2,4,5,7,8,1,6,9,0,3 };
	int sz = sizeof(a) / sizeof(a[0]);
	PrintArr(a, sz);
	HeapSort(a, sz);
	PrintArr(a, sz);
}

void TestBubbleSort()
{
	printf("BubbleSort:\n");
	int a[] = { 2,4,5,7,8,1,6,9,0,3 };
	int sz = sizeof(a) / sizeof(a[0]);
	PrintArr(a, sz);
	BubbleSort(a, sz);
	PrintArr(a, sz);
}


void TestQuickSort1()
{
	printf("QuickeSort1:\n");
	int a[] = { 6,4,5,7,8,1,2,9,0,3 };
	int sz = sizeof(a) / sizeof(a[0]);
	PrintArr(a, sz);
	QuickSort1(a,0,sz-1);
	PrintArr(a, sz);
}

void TestQuickSort2()
{
	printf("QuickeSort2:\n");
	int a[] = { 6,4,5,7,8,1,2,9,0,3 };
	int sz = sizeof(a) / sizeof(a[0]);
	PrintArr(a, sz);
	QuickSort2(a, 0, sz - 1);
	PrintArr(a, sz);
}
void TestQuickSort3()
{
	printf("QuickeSort3:\n");
	int a[] = { 6,4,5,7,8,1,2,9,0,3 };
	int sz = sizeof(a) / sizeof(a[0]);
	PrintArr(a, sz);
	QuickSort3(a, 0, sz - 1);
	PrintArr(a, sz);
}

void TestQuickSortNonR()
{
	printf("QuickeSortNonR:\n");
	int a[] = { 6,4,5,7,8,1,2,9,0,3 };
	int sz = sizeof(a) / sizeof(a[0]);
	PrintArr(a, sz);
	QuickSortNonR(a, 0, sz - 1);
	PrintArr(a, sz);
}

void TestMergeSort()
{
	printf("MergeSort:\n");
	int a[] = { 6,4,5,7,8,1,2,9,0,3 };
	int sz = sizeof(a) / sizeof(a[0]);
	PrintArr(a, sz);
	MergeSort(a, sz);
	PrintArr(a, sz);
}

void TestMergeSortNonR()
{
	printf("MergeSortNonR:\n");
	int a[] = { 6,4,5,7,8,1,2,9,0 };
	int sz = sizeof(a) / sizeof(a[0]);
	PrintArr(a, sz);
	MergeSortNonR(a, sz);
	PrintArr(a, sz);
}

void TestCountSort()
{
	printf("CountSort:\n");
	int a[] = { 111,101,-1,102,101 };
	int sz = sizeof(a) / sizeof(a[0]);
	PrintArr(a, sz);
	CountSort(a, sz);
	PrintArr(a, sz);
}

void TestQuickSortThreeWay()
{
	printf("QuickSortThreeWay:\n");
	int a[] = {6,3,5,6,8,6,2,6,9 };
	int sz = sizeof(a) / sizeof(a[0]);
	PrintArr(a, sz);
	QuickSortThreeWay(a, 0, sz-1);
	PrintArr(a, sz);
}

int main()
{
	srand((unsigned)time(NULL));
	//TestInsertSort();
	//TestShellSort();
	//TestSelectSort1();
	//TestSelectSort2();
	//TestHeapSort();
	//TestBubbleSort();
	//TestQuickSort1();
	//TestQuickSort2();
	//TestQuickSort3();
	//TestQuickSortNonR();
	//TestMergeSort();
	//TestMergeSortNonR();
	//TestCountSort();
	
	//TestQuickSortThreeWay();
	//TestTop();
	return 0;
}